<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="vue.js"></script>
    <title>Document</title>
    <style>
        .ball {
            width: 15px;
            height: 15px;
            background-color: hotpink;
            border-radius: 50%;
        }
    </style>
</head>

<body>
    <div id="app">
        <com1 :parentmsg="msg"></com1>
    </div>
</body>

<script>
    var vm = new Vue({
        el: '#app',
        data: {
            msg: '父组件中的内容'
        },
        components: {
            com1: {
                template: '<h1>这是子组件 {{ parentmsg }}</h1>',
                props: ['parentmsg'], //把父组件传过来的值先定义才能使用，这个数据时只读的
                data() {
                    return {

                    }
                }
            }

        },

        methods: {
            beforeEnter(el) {
                el.style.transform = 'translate(0,0)'
            },
            enter(el, done) {
                el.offsetWidth
                el.style.transform = 'translate(150px,450px)'
                el.style.transition = 'all 1s ease'
                done()
            },
            afterEnter(el) {
                this.flag = !this.flag
            }

        }

    })
</script>

</html>